package day04;
import java.util.Scanner;

import org.junit.Test;

public class demo1 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入学生的数量:");
		int num = scanner.nextInt();
		Student[] students = new Student[num];
		for(int i = 0; i < students.length; i++) {
			System.out.println("请输入学生的id:");
			int id = scanner.nextInt();
			System.out.println("请输入学生的姓名:");
			String name = scanner.next();
			System.out.println("请输入学生的年龄:");
			int age = scanner.nextInt();
			System.out.println("请输入学生的班级:");
			String className = scanner.next();
			// 每次循环构造一个Student对象
			Student student = new Student();
			student.id = id;
			student.name = name;
			student.age = age;
			student.className  = className;
			// 把构造的学生对象放到指定下标位置
			students[i] = student;
		}
		for (int i = 0; i < students.length; i++) {
			Student student = students[i];
			System.out.println(student.id);
			System.out.println(student.name);
			System.out.println(student.age);
			System.out.println(student.className);
			
		}
		
	}
	
	
	@Test
	public void test01() {
		int num = 3;
		int[] array = new int[4];
		String string = new String("abc");
		String str = "abc";
		Student zhangsan = new Student();
		zhangsan.id = 3;
		zhangsan.name = "张三";
		zhangsan.age = 14;
		zhangsan.className = "java1912";
		zhangsan.study();
		
	}

}
